<div class="wrapper clearfix">
    <section class="cl_left">
            <?php $this->load->view('mod_email/menu');?>
    </section>
    <div class="primary">
       <?php
            if(!empty($mangnoi))
                {
                    ?>
                <br/>
				<article id="main_primary">
					<div class="box_traloi clearfix">
						<form action="<?php echo base_url().'email/chi-tiet/'.$this->uri->segment(3).'.html'; ?>" method="POST">
							<textarea  name="mes_traloi" id="mss_traloi" placeholder="Nhập tin nhắn trả lời của bạn"></textarea>
							<input value="Trả lời" type="submit" class="btn_view submit_rep" name="submit" />
							<div class="clearfix"></div>
							<h4>Vui lòng k nhập địa chỉ liên lạc, số điện thoại và email của bạn.</h4>
						</form>
						<?php if(!empty($thongbao)) { echo $thongbao;} ?>
					</div>
					<br/>
                      <section class="main_email traloi_mail">
                    <?php foreach ($mangnoi as $email)
                        {
                            $mail_info = $this->common_model->getone('users',array('email'=>$email->email_from),array('id','avartar','name','type'));
							$img = explode(',',$mail_info->avartar);
                            if($email->email_from != $this->session->userdata('email')) { 
					?>
						<div class="box_noidung clearfix">
							<div class="sent_mss cleafix">
								<div class="lef_mail_details">
									<?php if(!empty($mail_info->avartar)){ ?>
									<a target="_blank" href="<?php echo base_url().'thong-tin-gia-su.'.$mail_info->id.'.html'; ?>" title="Xem thông tin gia sư">
										<img src="<?php echo get_thumnails($img[0],70,70); ?>" width="70" height="70" alt=""/>
									</a>
									<?php } else { ?>
										<img src="<?php echo get_thumnails(base_url().'skin/front-end/images/logo.png',70,70);  ?>" width="70" height="70" alt=""/>
									<?php } ?>
								</div>
								<div class="content_1">
									<div class="content_mail">
										<?php echo '<p style="font-weight:bold;font-size:16px;text-transform:capitalize;color:#7DB520">'.$mail_info->name.'<span style="color:#777777;font-weight:normal;font-size:10px;float:right;">( '.$email->date.' )</span></p> '.$email->description; ?>
									</div>
									<span class="arr">&nbsp;</span>
								</div>
							</div>
						</div>
						<?php } else { ?>
						<div class="box_noidung clearfix">
							<div class="sent_mss cleafix">
								<div class="lef_mail_details" style="float: right;">
									<a target="_blank" href="<?php echo base_url().'thong-tin-gia-su.'.$mail_info->id.'.html'; ?>" title="Xem thông tin gia sư">
									<?php if(!empty($mail_info->avartar)){ ?>
										<img src="<?php echo get_thumnails($img[0],60,60); ?>" width="60" height="60" alt=""/>
									<?php } else { ?>
										<img src="<?php echo get_thumnails(base_url().'skin/front-end/images/logo.png',60,60);  ?>" width="60" height="60" alt=""/>
									<?php } ?>
									</a>
								</div>
								<div class="content_1 box-rep">
									<div class="content_mail">
										<?php echo '<p style="font-weight:bold;font-size:16px;text-transform:capitalize;color:#7DB520;">Bạn '.'<span style="color:#777777;font-weight:normal;font-size:10px;float:right;">( '.$email->date.' )</span></p>'.$email->description; ?>
									</div>
									<span class="arr2">&nbsp;</span>
								</div>
							</div>
						</div>
						<?php 
							}
                        } ?>
					</section>
				</article>
                        <?php   
                }
       ?>
    </div>
</div>
<style>
.email_list
{
    position:relative;
}
.email_list a
{
    text-decoration:none;
}
.date_sent
{
    position:absolute;
    right:10px;
    top:70px;
    color:#777777;
    font-weight:bold;
}
.info_mail
{
    width:100px;
    float:left;
}
.take_mss_tutor {
    width: 95px;
}
</style>
